package com.jml.activitymq.整合springboot.producer;

import javax.jms.Queue;
import javax.jms.Topic;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import com.alibaba.fastjson.JSONObject;



public class Produce发送邮件 {

	@Autowired
	private JmsMessagingTemplate jmsMessagingTemplate;
	@Autowired
	private Queue queue;

	@Scheduled(fixedDelay = 5000)
	public void send() {
		JSONObject jsonObject = new JSONObject();
		String userName = System.currentTimeMillis() + "";
		jsonObject.put("userName", userName);
		jsonObject.put("eamil", "xxxx@163.com");
		String msg = jsonObject.toJSONString();
		System.out.println("生产者向消费者发送内容:" + msg);
		jmsMessagingTemplate.convertAndSend(queue, msg);
	}
}
